Application-level dispatcher control of application-level pseudo threads and operating system threads

ABSTRACT

An application-level thread dispatcher that operates in a main full-weight thread allocated to an application is established. The application-level thread dispatcher initializes a group of application-level pseudo threads that operate as application-controlled threads within the main full-weight thread allocated to the application. The application-level thread dispatcher determines that at least one application-level pseudo thread meets configuration requirements to operate within a separate operating system-level thread in parallel with the main full-weight thread. In response to determining that the at least one application-level pseudo thread meets the configuration requirements to operate within the separate operating system-level thread in parallel with the main full-weight thread, the at least one application-level pseudo thread is dispatched from the main full-weight thread to the separate operating system-level thread by the application-level thread dispatcher.

BACKGROUND

The present invention relates to application process threads. Moreparticularly, the present invention relates to application-leveldispatcher control of application-level pseudo threads and operatingsystem threads.

Certain operating systems provide operating system-level “threads”(alternatively native threads) that may be invoked to perform processingof application functionality. The operating system-level threads allexecute on a central processing unit (CPU) and share CPU processingcycles under control of the operating system.

BRIEF SUMMARY

A method includes establishing, by a processor, an application-levelthread dispatcher that operates in a main full-weight thread allocatedto an application; initializing, by the application-level threaddispatcher, a plurality of application-level pseudo threads that operateas application-controlled threads within the main full-weight threadallocated to the application; determining, by the application-levelthread dispatcher, that at least one application-level pseudo threadmeets configuration requirements to operate within a separate operatingsystem-level thread in parallel with the main full-weight thread; anddispatching, from the main full-weight thread by the application-levelthread dispatcher in response to determining that the at least oneapplication-level pseudo thread meets the configuration requirements tooperate within the separate operating system-level thread in parallelwith the main full-weight thread, the at least one application-levelpseudo thread to the separate operating system-level thread.

A system includes a memory, and a processor programmed to: establish anapplication-level thread dispatcher that operates in a main full-weightthread allocated within the memory to an application; initialize, by theapplication-level thread dispatcher, a plurality of application-levelpseudo threads that operate as application-controlled threads within themain full-weight thread allocated to the application; determine, by theapplication-level thread dispatcher, that at least one application-levelpseudo thread meets configuration requirements to operate within aseparate operating system-level thread in parallel with the mainfull-weight thread; and dispatch, from the main full-weight thread bythe application-level thread dispatcher in response to determining thatthe at least one application-level pseudo thread meets the configurationrequirements to operate within the separate operating system-levelthread in parallel with the main full-weight thread, the at least oneapplication-level pseudo thread to the separate operating system-levelthread.

A computer program product includes a computer readable storage mediumhaving computer readable program code embodied therewith, where thecomputer readable program code when executed on a computer causes thecomputer to: establish an application-level thread dispatcher thatoperates in a main full-weight thread allocated to an application;initialize, by the application-level thread dispatcher, a plurality ofapplication-level pseudo threads that operate as application-controlledthreads within the main full-weight thread allocated to the application;determine, by the application-level thread dispatcher, that at least oneapplication-level pseudo thread meets configuration requirements tooperate within a separate operating system-level thread in parallel withthe main full-weight thread; and dispatch, from the main full-weightthread by the application-level thread dispatcher in response todetermining that the at least one application-level pseudo thread meetsthe configuration requirements to operate within the separate operatingsystem-level thread in parallel with the main full-weight thread, the atleast one application-level pseudo thread to the separate operatingsystem-level thread.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a block diagram of an example of an implementation of a coreprocessing module of a computing device that may provideapplication-level dispatcher control of application-level pseudo threadsand operating system threads according to an embodiment of the presentsubject matter;

FIG. 2 is a block diagram of an example of an implementation of anapplication-level thread dispatcher that may perform application-leveldispatcher control of application-level pseudo threads and operatingsystem threads according to an embodiment of the present subject matter;

FIG. 3 is a flow chart of an example of an implementation of a processfor application-level dispatcher control of application-level pseudothreads and operating system threads according to an embodiment of thepresent subject matter; and

FIG. 4 is a flow chart of an example of an implementation of a processfor application-level dispatcher control of application-level pseudothreads, lighter-weight operating system threads, and full-weightoperating system threads according to an embodiment of the presentsubject matter.

DETAILED DESCRIPTION

The examples set forth below represent the necessary information toenable those skilled in the art to practice the invention and illustratethe best mode of practicing the invention. Upon reading the followingdescription in light of the accompanying drawing figures, those skilledin the art will understand the concepts of the invention and willrecognize applications of these concepts not particularly addressedherein. It should be understood that these concepts and applicationsfall within the scope of the disclosure and the accompanying claims.

The subject matter described herein provides application-leveldispatcher control of application-level pseudo threads and operatingsystem threads. The present technology provides an application-levelthread dispatcher that performs several different thread controls. Theapplication-level thread dispatches and dynamically manages threedistinct categories of threads: application-level pseudo threads,full-weight operating system-level threads, and lighter-weight operatingsystem-level threads across multiple central processing units(CPUs—“processors”). The application-level thread dispatcher facilitatesand manages application-level pseudo threads to avoid increasingoperating system-level thread usage while also exploiting multiple CPUsto achieve higher throughputs during burst periods. Theapplication-level thread dispatcher further dynamically adds and/orremoves operating system-level threads (full-weight or lighter-weightthreads) to offload qualifying work to those added system threads forconcurrent processing. As such, the application-level thread dispatcherboth manages application-level pseudo threads on a main full-weightoperating system-level thread of the application itself, and dispatchesqualifying work to dynamically added lighter-weight operatingsystem-level threads and additional full-weight operating system-levelthreads. Accordingly, the present technology may improveapplication-level processing throughput while also reducing systemcosts.

For purposes of the present description, the terms “application-levelpseudo thread” and “pseudo thread” are used interchangeably and refer tothreads that do not rely upon an operating system for management.Additionally, the terms “operating system-level thread,” “system-levelthread,” and “system thread” are also used interchangeably herein andrefer to one of two types of operating system threads based upon thecontext within which the terms are used. A “full-weight” system threadmay be considered a thread that may be used to execute an applicationwith full access to resources sufficient to fully-execute theapplication within the respective operating system. In contrast, a“lighter-weight” system thread may be considered a thread with limitedaccess to resources relative to a full-weight system thread. Further theterms “application-level thread dispatcher” and “application-leveldispatcher” are used interchangeably.

Additionally, for purposes of the present description, the term“thread-safe” represents a form of processing within a shared-resourcemulti-threaded environment that ensures a safe use of the sharedresources that allows multiple threads to run concurrently withoutcausing problems. As such, a thread-safe operation may include lockingof resources, control of serialization for accesses to resources, orother processing as appropriate for a given implementation.

It should be noted that an entire application does not need to bethread-safe to use alternative system threads as described herein.Additionally, and in contrast to prior technologies, an applicationdesigned as described herein may run on multiple system threadssimultaneously.

The present technology may be utilized in a variety of implementations.For example, decompressing data buffers, decrypting data buffers, andreading files represent a few examples of implementations where work maybe delegated to a given pseudo thread, to a lighter-weight systemthread, and to another full-weight system thread. Delegated work may bequeued to respective threads for processing. Many other uses of thepresent technology are possible and all such uses are considered withinthe scope of the present description.

Regarding queuing of work to pseudo threads, to lighter-weight systemthreads, and to other full-weight system threads, the queuing of workmay be performed by placing function pointers into work dispatchingqueues. The function pointers may be utilized by the respective threadsto directly invoke an appropriate function referenced by the respectivefunction pointer to perform the delegated work. For such animplementation, it is understood that the function referenced by therespective function pointers would be memory mapped and accessible bythe respective threads. While the example of using function pointers andmemory mapping is provided, it should be noted that any other form ofwork delegation may be utilized as appropriate for a givenimplementation. It should be noted that it may be considered a distinctoperation to put work on a queue and another distinct operation toinvoke another thread, and that these operations may be controlled bythe application-level thread dispatcher.

Further regarding the application-level thread dispatcher, theapplication-level thread dispatcher operates within the main full-weightsystem thread in which the application executes and emulates its ownthreading model that gives each pseudo thread a portion of the overalltime the operating system gives to the main full-weight system thread.As such, the pseudo threads are not scheduled by the operating system,but are instead managed at the application level by theapplication-level thread dispatcher that runs in the main full-weightoperating system-level thread of the application. It should be notedthat the application-level thread dispatcher creates and schedules theapplication-level pseudo thread.

Additionally, the application-level thread dispatcher dynamically addsand removes lighter-weight system threads in conjunction with managingthe pseudo threading from the full-weight system thread. Thelighter-weight system threads may be considered threads of limitedresources that operate in a restricted environment, and aredistinguishable as such from full-weight system threads. Thelighter-weight system threads may be implemented to execute onspecialized hardware or on the same platform as the full-weight systemthreads. Alternatively, the lighter-weight system threads may beimplemented as a distinct form of an executional control unit within aparticular operating system. For example, on a z/OS® operating system,the lighter-weight system threads may be implemented as Service RequestBlocks (SRBs), while the full-weight system threads may be implementedas Task Control Blocks (TCBs). Alternatively, on other operatingsystems, such as UNIX, threads may be differentiated between heavyweightthreads and lightweight threads, and the full-weight and lighter-weightthreads described herein may be implemented using the respectiveheavyweight and lightweight operating system threads. Many otherpossibilities for distinguishing and implementing the full-weight systemthreads and lighter-weight system threads are possible, as appropriatefor the given implementation, and all such possibilities are consideredwithin the scope of the present technology.

The application-level thread dispatcher may schedule itsresponsibilities in three primary modes to manage the various threads(e.g., full-weight system thread, pseudo threads, and lighter-weightsystem threads) based on application design and configuration. The modesof scheduling may be considered granular and managed at a task level foreach scheduled responsibility. For example, the application-level threaddispatcher may schedule its responsibilities in a first mode as a pseudothread running in the same full-weight system thread as theapplication-level thread dispatcher, may schedule its responsibilitiesin a second mode as a work item queued to another available full-weightsystem thread, or may schedule its responsibilities in a third mode as awork item queued to another available lighter-weight system thread.

As such, the pseudo thread may be dispatched to the same full-weightsystem thread that executes the application-level thread dispatcher orto a different full-weight system thread if the application isconfigured to utilize one or more other full-weight system threads.Alternatively, the pseudo thread may be dispatched to a lighter-weightsystem thread that operates on the same CPU or on a different CPU.

It should additionally be noted that full-weight system threads may beorganized into a pool/group of full-weight system threads, and asdescribed herein, the pool size may be adjusted within systemconstraints (e.g., thread availability, other executing applications,etc.). Lighter-weight system threads may also be organized into apool/group of available lighter-weight system threads, and the pool sizemay be adjusted within system constraints (e.g., again threadavailability, other executing applications, etc.).

With respect to scheduling its responsibilities as a pseudo threadrunning in the same full-weight system thread as the application-levelthread dispatcher, the application-level thread dispatcher manages thepseudo threads to cooperatively yield back to the application-levelthread dispatcher when responsibilities are dispatched in this mode.This present technology allows a pseudo thread to offload a segment ofits work by creating its own work items, as described in more detailbelow. The offloading of a segment of work allows a pseudo thread toyield back to the application-level thread dispatcher more quickly byaddressing any processing that requires the full-weight system thread(e.g., opening a file), and then offloading the remaining processing(e.g., reading contents of the file) to a lighter-weight system threadto allow this processing to occur in parallel with the full-weightthread that is now able to dispatch another pseudo thread. As describedabove, and in more detail below, the lighter-weight system thread may bedispatched to a distinct CPU to effect true parallel/concurrentprocessing.

With respect to scheduling its responsibilities under the second mode orthird mode as a work item queued to another available full-weight systemthread or to a lighter-weight system thread operating on the same or adifferent processor, respectively, a work queue may be implemented foreach respective system thread to communicate work items that areavailable for processing by the alternative system threads. Each workitem represents an independent piece of work that may be processedasynchronously in a thread-safe manner. It should be noted that it maybe considered a distinct operation to put work on a queue and anotherdistinct operation to resume a lighter-weight system thread or invoke afull-weight thread, respectively, and that these operations may becontrolled by the application-level thread dispatcher.

With respect to scheduling its responsibilities as a work item queued toanother available full-weight system thread under the second mode, thework queue may also be used to communicate work items that are availablefor processing by the additional full-weight system threads. Asdescribed above, full-weight threads may be configured for use byapplications and the application-level thread dispatcher. As such, theapplication-level thread dispatcher may utilize an operating systemmechanism to push the task over to another available full-weight systemthread, and use work queues for communication of tasks to and outputsfrom the respective other available full-weight system threads.

Further, with respect to scheduling its responsibilities under the thirdmode as a work item queued to a lighter-weight system thread operatingon the same or a different processor, the application-level threaddispatcher identifies a pseudo thread as conforming to any restrictionsrelated to processing of tasks within the lighter-weight system threadenvironment. In this scenario, where the entire pseudo thread is definedas eligible to run on a lighter-weight system thread, theapplication-level thread dispatcher schedules the pseudo thread toexecute on a lighter-weight system thread within the respectiveconfigured limits of the lighter-weight system thread environment. Assuch, the application-level thread dispatcher utilizes an operatingsystem mechanism to push the task over to a lighter-weight systemthread, and uses work queues for communication of tasks to and outputsfrom the respective lighter-weight system threads.

As described above, scheduling between pseudo threads and lighter-weightsystem threads may be based upon a respective pseudo thread's definitionregarding whether its processing conforms to the restricted nature ofthe lighter-weight system thread environment. For example, theapplication-level thread dispatcher may have knowledge with respect to aparticular system that a file cannot be opened by a lighter-weightsystem thread and that such processing must be performed on thefull-weight system thread, potentially as a pseudo thread. Theapplication-level thread dispatcher may dispatch the file openingoperation to a pseudo thread and set a flag indicating that the file hasbeen opened. The next time an operation related to the file (e.g., aread or write) is to be performed, the application-level threaddispatcher may evaluate the flag and determine that file is alreadyopened, and may assign the subsequent processing to a lighter-weightsystem thread. As such, the application-level thread dispatcher maygranularly assign tasks based upon the state of the respective systemresources and may use flags associated with the resources to route anddispatch processing tasks to appropriate threads (e.g., full-weight,pseudo, and lighter-weight threads, respectively).

It should be noted that conception of the present subject matterresulted from recognition of certain limitations associated with use ofoperating system-level threads. For example, it was observed thatoperating system-level threads are limited within any particularoperating environment by the constraints of the operating system.Additionally, it was observed that applications may be limited in theirability to partition work by these operating system-level constraints.In view of these observations, it was determined that a more granularform of thread dispatching performed by an application-level threaddispatcher that partitions application-level processing toapplication-level pseudo threads described herein may improveapplication-level task/work processing without requiring operatingsystem-level controls. It was additionally determined from theseobservations that application-level control of dispatching of operatingsystem-level threads to multiple CPUs may further expand processingcapabilities of executing applications. It was further determined thatuse of technology to employ application-level pseudo threading may avoidthe costs of multiple system threads while exploiting multipleprocessors/CPUs to achieve higher application-level throughputs and mayimprove application-level processing of tasks during burst periods. Itwas also determined that, based upon particular states of dataprocessing, the application-level control of thread dispatching toapplication-level pseudo threads and to operating system-level threadsacross multiple processors that allows routine adjustment (e.g.,promotion) of thread-type assignments may be leveraged to balance andimprove the cross-thread dispatching. For example, it was determinedthat certain operations, such as opening a file may require the work tobe assigned to a full-weight operating system-level thread by nature ofthe operating system design (e.g., either the application-leveldispatching thread or another available full-weight thread), whereasprocessing the contents of an opened file may be processed by anapplication-level pseudo thread on any available thread, includinglighter-weight threads. It was determined that application-level threaddispatching that evaluates a given state of a particularapplication-level task and that migrates the work over time to differentthread types based upon that state may improve efficiency ofapplication-level processing. The present subject matter improvesapplication-level thread processing by providing for thread dispatchingbetween application and operating system levels, and across multipleCPUs, as described above and in more detail below. The presenttechnology provides control capabilities to add capacity during peakperiods. The addition of capacity may be dynamically controlled andadjustable through configuration. As such, improved application-levelprocessing may be obtained through use of the present technology.

The application-level dispatcher control of application-level pseudothreads and operating system threads described herein may be performedin real time to allow prompt control and management of bothapplication-level pseudo threads and operating system-level threadsacross multiple discrete CPUs. For purposes of the present description,real time shall include any time frame of sufficiently short duration asto provide reasonable response time for information processingacceptable to a user of the subject matter described. Additionally, theterm “real time” shall include what is commonly termed “near realtime”—generally meaning any time frame of sufficiently short duration asto provide reasonable response time for on-demand information processingacceptable to a user of the subject matter described (e.g., within aportion of a second or within a few seconds). These terms, whiledifficult to precisely define are well understood by those skilled inthe art.

FIG. 1 is a block diagram of an example of an implementation of a coreprocessing module 100 of a computing device that may provideapplication-level dispatcher control of application-level pseudo threadsand operating system threads. As described above and in more detailbelow in association with FIG. 2 through FIG. 4, the core processingmodule 100 may provide automated application-level dispatcher control ofapplication-level pseudo threads and operating system threads bybalancing performance and system constraints using application-levelpseudo threads, other full-weight system threads, and lighter-weightsystem threads that operate on the same or a different processor. Thepresent technology may be implemented at a user computing device orserver device level, as appropriate for a given implementation. Avariety of possibilities exist for implementation of the present subjectmatter, and all such possibilities are considered within the scope ofthe present subject matter.

As described above, the core processing module 100 may be associatedwith either a user computing device or with a server computing device,as appropriate for a given implementation. Further, different processorsmay be implemented on different hardware platforms or within the samehardware platform, as appropriate for a given implementation. As such,the core processing module 100 is described generally herein, though itis understood that many variations on implementation of the componentswithin the core processing module 100 are possible and all suchvariations are within the scope of the present subject matter.

Further, the core processing module 100 may provide different andcomplementary processing of application-level dispatcher control ofapplication-level pseudo threads and operating system threads inassociation with each implementation. As such, for any of the examplesbelow, it is understood that any aspect of functionality described withrespect to any one device that is described in conjunction with anotherdevice (e.g., sends/sending, etc.) is to be understood to concurrentlydescribe the functionality of the other respective device (e.g.,receives/receiving, etc.).

A central processing unit (CPU) 102 (“processor”) provides hardware thatperforms computer instruction execution, computation, and othercapabilities within the core processing module 100. A display 104provides visual information to a user of the core processing module 100and an input device 106 provides input capabilities for the user.

The display 104 may include any display device, such as a cathode raytube (CRT), liquid crystal display (LCD), light emitting diode (LED),electronic ink displays, projection, touchscreen, or other displayelement or panel. The input device 106 may include a computer keyboard,a keypad, a mouse, a pen, a joystick, touchscreen, voice commandprocessing unit, or any other type of input device by which the user mayinteract with and respond to information on the display 104.

It should be noted that the display 104 and the input device 106 may beoptional components for the core processing module 100 for certainimplementations/devices, or may be located remotely from the respectivedevices and hosted by another computing device that is in communicationwith the respective devices. Accordingly, the core processing module 100may operate as a completely automated embedded device without directuser configurability or feedback. However, the core processing module100 may also provide user feedback and configurability via the display104 and the input device 106, respectively, as appropriate for a givenimplementation.

A communication module 108 provides hardware, protocol stack processing,and interconnection capabilities that allow the core processing module100 to communicate with other modules via a network or othercommunications technology. The communication module 108 may include anyelectrical, protocol, and protocol conversion capabilities useable toprovide interconnection capabilities, appropriate for a givenimplementation.

A memory 110 includes an operating system area 112 that provides storageand execution space for one or more operating systems for the coreprocessing module 100. The operating system area 112 includes afull-weight thread pool 114 and a lighter-weight thread pool 116. Asdescribed above, the sizes of the respective thread pools may bepre-configured, and may be dynamically adjusted within systemconstraints by the application-level thread dispatcher. Further, as alsodescribed above, the application-level thread dispatcher operates withinone of the full-weight system threads within the full-weight thread pool114, and as such, the application-level thread dispatcher is notseparately illustrated within FIG. 1. The operating system area 112further provides execution space for one or more applications, andseparate storage space for the application(s) may be provided within thememory 110 (not shown).

The memory 110 further includes a work dispatching queues area 118. Thework dispatching queues area 118 may be utilized to dynamically createone or more work queues implemented for each respective system thread tocommunicate work items that are available for processing by thealternative system threads.

It is understood that the memory 110 may include any combination ofvolatile and non-volatile memory suitable for the intended purpose,distributed or localized as appropriate, and may include other memorysegments not illustrated within the present example for ease ofillustration purposes. For example, the memory 110 may also include acode storage area and a data area without departure from the scope ofthe present subject matter.

One or more thread execution offload processor(s) 120 are alsoillustrated generally as a single element within FIG. 1 for ease ofillustration. The thread execution offload processor(s) 120 provideadditional execution space for threads within the core processing module100, as described above and in more detail below. The thread executionoffload processor(s) 120 may be utilized, as described above, to offloadwork from a pseudo thread under circumstances where the pseudo threadoperations are compliant with the processing requirements of the threadexecution offload processor(s) 120. The thread execution offloadprocessor(s) 120 may include their own memory and operating systems, ormay utilize the memory 110 and the operating system area 112, asappropriate for a given implementation.

The CPU 102, the display 104, the input device 106, the communicationmodule 108, the memory 110, and the thread execution offloadprocessor(s) 120 are interconnected via an interconnection 122. Theinterconnection 122 may include a system bus, a network, or any otherinterconnection capable of providing the respective components withsuitable interconnection for the respective purpose.

Though the different modules illustrated within FIG. 1 are illustratedas component-level modules for ease of illustration and descriptionpurposes, it should be noted that these modules may include anyhardware, programmed processor(s), and memory used to carry out thefunctions of the respective modules as described above and in moredetail below. For example, the modules may include additional controllercircuitry in the form of application specific integrated circuits(ASICs), processors, antennas, and/or discrete integrated circuits andcomponents for performing communication and electrical controlactivities associated with the respective modules. Additionally, themodules may include interrupt-level, stack-level, and application-levelmodules as appropriate. Furthermore, the modules may include any memorycomponents used for storage, execution, and data processing forperforming processing activities associated with the respective modules.The modules may also form a portion of other circuitry described or maybe combined without departure from the scope of the present subjectmatter.

Additionally, while the core processing module 100 is illustrated withand has certain components described, other modules and components maybe associated with the core processing module 100 without departure fromthe scope of the present subject matter. Additionally, it should benoted that, while the core processing module 100 is described as asingle device for ease of illustration purposes, the components withinthe core processing module 100 may be co-located or distributed andinterconnected via a network without departure from the scope of thepresent subject matter. For a distributed arrangement, the display 104and the input device 106 may be located at a point of sale device,kiosk, or other location, while the CPU 102 and memory 110 may belocated at a local or remote server. Many other possible arrangementsfor components of the core processing module 100 are possible and allare considered within the scope of the present subject matter.Accordingly, the core processing module 100 may take many forms and maybe associated with many platforms.

FIG. 2 is a block diagram of an example of an implementation of anapplication-level thread dispatcher that may perform application-leveldispatcher control of application-level pseudo threads and operatingsystem threads. An application 200 is shown to be executing within thememory 110, and is understood to be operating within the operatingsystem area 112.

The full-weight thread pool 114, the lighter-weight thread pool 116, andthe work dispatching queues 118 are again illustrated to show aninterrelationship between the respective elements. The thread executionoffload processor(s) 120 are also illustrated to show theinterrelationship with the other depicted components. As can be seenwithin FIG. 2, the thread execution offload processor(s) 120 operateoutside of the thread scope of the application 200.

As described above, applications such as the application 200 may beconfigured to allow utilization of more than one full-weight thread. Assuch, the work dispatching queues 118 has a path to one or more otherfull-weight system threads (not shown) within the full-weight threadpool 114. The work dispatching queues 118 also has a path to one or moreother lighter-weight system threads (not shown) within thelighter-weight thread pool 116, and has a path to the thread executionoffload processor(s) 120.

An application-level thread dispatcher 202 is illustrated within thefull-weight thread pool 114. As also described above, theapplication-level thread dispatcher 202 executes within the full-weightsystem thread that executes the application 200.

The application-level thread dispatcher 202 is shown to include and alsomanage a pseudo thread pool 204. The pseudo thread pool 204 represent anapplication-level managed threading environment under which theapplication-level thread dispatcher 202 dispatches portions of work forexecution within the full-weight system thread that executes theapplication 200. As also described above, and in more detail below,pseudo threads may be dispatched by the application-level threaddispatcher 202 to other full-weight system threads, and to otherlighter-weight system threads operating on the same CPU or alternativelyon one or more of the thread execution offload processor(s) 120.

As described above, the application-level thread dispatcher 202 maydynamically adjust (add and remove) pseudo threads within the pseudothread pool 204 and may dynamically adjust lighter-weight threads withinthe lighter-weight thread pool 116 and full-weight threads within thefull-weight thread pool 114. Dynamic adjustment of the respectivethreads within the respective thread pools may be based upon analysis ofthe run-time performance of the application, such as the application200, that is managed by the application-level thread dispatcher 202.

FIG. 3 through FIG. 4 described below represent example processes thatmay be executed by devices, such as the core processing module 100, toperform the automated application-level dispatcher control ofapplication-level pseudo threads and operating system threads associatedwith the present subject matter. Many other variations on the exampleprocesses are possible and all are considered within the scope of thepresent subject matter. The example processes may be executed by anapplication-level thread dispatcher, such as the application-levelthread dispatcher 202 executed by the CPU 102. It should be noted thattime out procedures and other error control procedures are notillustrated within the example processes described below for ease ofillustration purposes. However, it is understood that all suchprocedures are considered to be within the scope of the present subjectmatter. Further, the described processes may be combined, sequences ofthe processing described may be changed, and additional processing maybe added or removed without departure from the scope of the presentsubject matter.

FIG. 3 is a flow chart of an example of an implementation of a process300 for application-level dispatcher control of application-level pseudothreads and operating system threads. At block 302, the process 300establishes by a processor, an application-level thread dispatcher thatoperates in a main full-weight thread allocated to an application. Atblock 304, the process 300 initializes, by the application-level threaddispatcher, a plurality of application-level pseudo threads that operateas application-controlled threads within the main full-weight threadallocated to the application. At block 306, the process 300 determines,by the application-level thread dispatcher, that at least oneapplication-level pseudo thread meets configuration requirements tooperate within a separate operating system-level thread in parallel withthe main full-weight thread. At block 308, the process 300 dispatches,from the main full-weight thread by the application-level threaddispatcher in response to determining that the at least oneapplication-level pseudo thread meets the configuration requirements tooperate within the separate operating system-level thread in parallelwith the main full-weight thread, the at least one application-levelpseudo thread to the separate operating system-level thread.

FIG. 4 is a flow chart of an example of an implementation of a process400 for application-level dispatcher control of application-level pseudothreads, lighter-weight operating system threads, and full-weightoperating system threads. At decision point 402, the process 400 makes adetermination as to whether an application startup event has beendetected. It is understood for purposes of the present example, that theapplication is designed to implement an application-level threaddispatcher. In response to determining that an application startup eventhas been detected, the process 400 establishes an application-levelthread dispatcher, such as the application-level thread dispatcher 202,on a full-weight system thread at block 404.

The application-level thread dispatcher may have subordinate systemthreads (e.g., helper system threads such as other full-weight systemthreads or lighter-weight system threads) that may be available to helpthe dispatching system thread schedule application-level work. Therespective other full-weight system threads or lighter-weight systemthreads are referred to generally as “helper” threads to reducecomplexity of the following description.

At block 406, the process 400 initializes any pseudo threads for theapplication based upon application configuration parameters. Pseudothreads may be initialized with the application startup and/or may bedynamically added to the application-level thread dispatcher afterinitialization by the application logic.

When the system thread reaches its “steady state” of processing, theprocess 400 transfers thread control to the application-level threaddispatcher at block 408. The application-level thread dispatcher isthereafter responsible for what the system thread does until theapplication-level thread dispatcher is signaled to end (e.g., when theapplication or system thread is being ended).

The process 400 enters an iterative loop to determine whether theapplication (or thread) has ended at decision point 410 or whether apseudo thread is ready (e.g., has been signaled to perform itsresponsibility) at decision point 412. It is understood that if theapplication (or thread) has ended at decision point 410, the process 400will return to decision point 402 and will iterate as described above.Otherwise, the processing iterates as described further below until theapplication (or thread) has ended.

Each pseudo thread may have properties associated with it that indicatewhether the pseudo thread is eligible to run on a helper system thread.There are multiple different points within the process 400 at which suchproperties are evaluated in association with decisions related todispatching a pseudo thread to a helper thread.

At decision point 414, the process 400 performs the first property checkto determine whether the pseudo thread is thread-safe. In response todetermining that the pseudo thread is not thread-safe, the process 400determines that the pseudo thread must execute on the full-weightdispatching system thread and the process 400 dispatches the pseudothread to execute on the full-weight dispatching system thread at block416. The process 400 returns to decision point 410 and iterates asdescribed above.

It should be noted that while the pseudo thread is executing on thefull-weight dispatching system thread, the application-level threaddispatcher is unable to dispatch other work. The application-leveldispatcher does not regain control until the pseudo thread yields, asdescribed above.

Returning to the description of decision point 414, in response todetermining, based upon a given pseudo thread's properties, that thegiven pseudo thread is thread-safe, the process 400 makes adetermination decision point 418 as to whether the pseudo thread hasbeen configured to run with a lighter-weight thread. If theapplication-level thread dispatcher has been configured to run withlighter-weight system threads (either on the same CPU, another generalpurpose CPU, or on a thread execution offload processor), then morepseudo thread properties may be examined to determine additionalprocessing.

In response to determining at decision point 418 that the pseudo threadhas been configured to run with a lighter-weight thread, the process 400makes a determination at decision point 420 as to whether the pseudothread is thread system compliant with respect to requirements ofexecution within the respective lighter-weight thread system (e.g.,whether the pseudo thread meets the requirements of the respectivelighter-weight thread system—either on the current CPU or on an threadexecution offload processor). In response to determining that the pseudothread is lighter-weight thread system compliant for the respectivelighter-weight thread system, the process 400 queues the pseudo threadto the pool of lighter-weight system threads at block 422 (again on thesame CPU or a different CPU). As described above, the queuing of thepseudo thread involves placing work within a queue, such as within thework dispatching queues 118, for which the pseudo thread is responsibleto perform, and invoking the lighter-weight system thread to process thework in the queue. As also described above, the application-level threaddispatcher may be able to dynamically increase its number or pool oflighter-weight or full-weight threads (subject to minimum/maximumconstraints) to execute the pseudo thread on another system threadrather than use the dispatching thread's resources. As such, part of theprocessing at decision point 422 is determining whether enough threadsexist, and potentially adjusting the respective thread pool sizeaccordingly and within system constraints. The process 400 returns todecision point 410 and iterates as described above.

Returning to the description of decision point 420, in response todetermining that the pseudo thread is not lighter-weight thread systemcompliant for the respective lighter-weight thread system, or inresponse to determining at decision point 418 that the pseudo thread hasnot been configured to run with a lighter-weight thread, the process 400makes a determination as to whether any full-weight system threads weredefined for the application at decision point 424. In response todetermining that there are full-weight system threads configured for theapplication, the process 400 queues the pseudo thread to that pool offull-weight system threads at block 426. As described above, theapplication-level thread dispatcher may be able to dynamically increaseits number or pool of lightweight or full-weight threads (subject tominimum/maximum constraints) to execute the pseudo thread on anothersystem thread rather than use the dispatching thread's resources. Assuch, even for an application with configured full-weight systemthreads, adjustments to the number of full-weight system threads in thethread pool associated with the application may be made by the process400. As such, part of the processing at decision point 426 isdetermining whether enough threads exist, and potentially adjusting therespective thread pool size accordingly and within system constraints.The process 400 returns to decision point 410 and iterates as describedabove.

Returning to the description of decision point 424, in response todetermining that there are not any full-weight system threads configuredfor the application and that allocation of a full-weight system threadto the application is not possible based upon configuration or currentsystem constraints, the process 400 executes the pseudo thread in thedispatching full-weight system thread as a pseudo thread at block 428.The process 400 returns to decision point 410 and iterates as describedabove.

As such, the process 400 initiates an application-level threaddispatcher. The application-level thread dispatcher performsdeterminations of where to execute individual pseudo threads based uponproperties associated with the respective pseudo threads and system andconfigured constraints for lighter-weight thread systems, and queues thepseudo threads to execute on lighter-weight system threads wherepossible within the respective constraints. The process 400 may alsoqueue pseudo threads to execute on other full-weight threads, againbased upon properties associated with the respective pseudo threads andsystem constraints for full-weight thread systems. The process 400processes any pseudo threads that are not threads safe within its ownfull-weight system thread.

As described above in association with FIG. 1 through FIG. 4, theexample systems and processes provide application-level dispatchercontrol of application-level pseudo threads and operating systemthreads. Many other variations and additional activities associated withapplication-level dispatcher control of application-level pseudo threadsand operating system threads are possible and all are considered withinthe scope of the present subject matter.

Those skilled in the art will recognize, upon consideration of the aboveteachings, that certain of the above examples are based upon use of aprogrammed processor, such as the CPU 102. However, the invention is notlimited to such example embodiments, since other embodiments could beimplemented using hardware component equivalents such as special purposehardware and/or dedicated processors. Similarly, general purposecomputers, microprocessor based computers, micro-controllers, opticalcomputers, analog computers, dedicated processors, application specificcircuits and/or dedicated hard wired logic may be used to constructalternative equivalent embodiments.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a,” “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the art basedupon the teachings herein without departing from the scope and spirit ofthe invention. The subject matter was described to explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. A method, comprising: establishing, by aprocessor, an application-level thread dispatcher that operates in amain full-weight thread allocated to an application; initializing, bythe application-level thread dispatcher, a plurality ofapplication-level pseudo threads that operate as application-controlledthreads within the main full-weight thread allocated to the application;determining, by the application-level thread dispatcher, that at leastone application-level pseudo thread meets configuration requirements tooperate within a separate operating system-level thread in parallel withthe main full-weight thread, comprising determining that configurationof the application-level pseudo thread complies with operatingenvironment constraints of a lighter-weight operating system-levelthread; and dispatching, from the main full-weight thread by theapplication-level thread dispatcher in response to determining that theat least one application-level pseudo thread meets the configurationrequirements to operate within the separate operating system-levelthread in parallel with the main full-weight thread, the at least oneapplication-level pseudo thread to the separate operating system-levelthread.
 2. The method of claim 1, where the separate operatingsystem-level thread comprises another full-weight operating system-levelthread.
 3. The method of claim 1, where: the separate operatingsystem-level thread comprises the lighter-weight operating system-levelthread.
 4. The method of claim 1, where the separate operatingsystem-level thread comprises the lighter-weight operating system-levelthread executed on a separate thread execution offload processor.
 5. Themethod of claim 1, where work performed by the application-level pseudothread that is dispatched to the separate operating system-level threadis thread-safe and the application-level pseudo thread performs thethread-safe work within the separate operating system-level thread inparallel with operations performed within the main full-weight thread bythe application-level thread dispatcher.
 6. The method of claim 1,further comprising: evaluating, by the application-level threaddispatcher, run-time performance of the application; and dynamicallyadjusting, in response to evaluating the run-time performance of theapplication, at least one of: a quantity of full-weight threadsallocated to the application; a quantity of application-level pseudothreads allocated to the application; and a quantity of lighter-weightoperating system threads allocated to the application.
 7. The method ofclaim 1, where dispatching, from the main full-weight thread by theapplication-level thread dispatcher in response to determining that theat least one application-level pseudo thread meets the configurationrequirements to operate within the separate operating system-levelthread in parallel with the main full-weight thread, the at least oneapplication-level pseudo thread to the separate operating system-levelthread comprises: placing work of the application-level pseudo threadwithin a work dispatching queue; and invoking the separate operatingsystem-level thread to process the work dispatching queue.
 8. A system,comprising: a memory; and a processor programmed to: establish anapplication-level thread dispatcher that operates in a main full-weightthread allocated within the memory to an application; initialize, by theapplication-level thread dispatcher, a plurality of application-levelpseudo threads that operate as application-controlled threads within themain full-weight thread allocated to the application; determine, by theapplication-level thread dispatcher, that at least one application-levelpseudo thread meets configuration requirements to operate within aseparate operating system-level thread in parallel with the mainfull-weight thread, comprising the processor being programmed todetermine that configuration of the application-level pseudo threadcomplies with operating environment constraints of a lighter-weightoperating system-level thread; and dispatch, from the main full-weightthread by the application-level thread dispatcher in response todetermining that the at least one application-level pseudo thread meetsthe configuration requirements to operate within the separate operatingsystem-level thread in parallel with the main full-weight thread, the atleast one application-level pseudo thread to the separate operatingsystem-level thread.
 9. The system of claim 8, where the separateoperating system-level thread comprises another full-weight operatingsystem-level thread.
 10. The system of claim 8, where: the separateoperating system-level thread comprises the lighter-weight operatingsystem-level thread.
 11. The system of claim 8, where the separateoperating system-level thread comprises the lighter-weight operatingsystem-level thread executed on a separate thread execution offloadprocessor.
 12. The system of claim 8, where work performed by theapplication-level pseudo thread that is dispatched to the separateoperating system-level thread is thread-safe and the application-levelpseudo thread performs the thread-safe work within the separateoperating system-level thread in parallel with operations performedwithin the main full-weight thread by the application-level threaddispatcher.
 13. The system of claim 8, where the processor is furtherprogrammed to: evaluate, by the application-level thread dispatcher,run-time performance of the application; and dynamically adjust, inresponse to evaluating the run-time performance of the application, atleast one of: a quantity of full-weight threads allocated to theapplication; a quantity of application-level pseudo threads allocated tothe application; and a quantity of lighter-weight operating systemthreads allocated to the application.
 14. A computer program product,comprising: a computer readable storage medium having computer readableprogram code embodied therewith, where the computer readable programcode when executed on a computer causes the computer to: establish anapplication-level thread dispatcher that operates in a main full-weightthread allocated to an application; initialize, by the application-levelthread dispatcher, a plurality of application-level pseudo threads thatoperate as application-controlled threads within the main full-weightthread allocated to the application; determine, by the application-levelthread dispatcher, that at least one application-level pseudo threadmeets configuration requirements to operate within a separate operatingsystem-level thread in parallel with the main full-weight thread,comprising causing the computer to determine that configuration of theapplication-level pseudo thread complies with operating environmentconstraints of a lighter-weight operating system-level thread; anddispatch, from the main full-weight thread by the application-levelthread dispatcher in response to determining that the at least oneapplication-level pseudo thread meets the configuration requirements tooperate within the separate operating system-level thread in parallelwith the main full-weight thread, the at least one application-levelpseudo thread to the separate operating system-level thread.
 15. Thecomputer program product of claim 14, where the separate operatingsystem-level thread comprises another full-weight operating system-levelthread.
 16. The computer program product of claim 14, where: theseparate operating system-level thread comprises the lighter-weightoperating system-level thread.
 17. The computer program product of claim14, where the separate operating system-level thread comprises thelighter-weight operating system-level thread executed on a separatethread execution offload processor.
 18. The computer program product ofclaim 14, where work performed by the application-level pseudo threadthat is dispatched to the separate operating system-level thread isthread-safe and the application-level pseudo thread performs thethread-safe work within the separate operating system-level thread inparallel with operations performed within the main full-weight thread bythe application-level thread dispatcher.
 19. The computer programproduct of claim 14, where the computer readable program code whenexecuted on the computer further causes the computer to: evaluate, bythe application-level thread dispatcher, run-time performance of theapplication; and dynamically adjust, in response to evaluating therun-time performance of the application, at least one of: a quantity offull-weight threads allocated to the application; a quantity ofapplication-level pseudo threads allocated to the application; and aquantity of lighter-weight operating system threads allocated to theapplication.
 20. The computer program product of claim 14, where incausing the computer to dispatch, from the main full-weight thread bythe application-level thread dispatcher in response to determining thatthe at least one application-level pseudo thread meets the configurationrequirements to operate within the separate operating system-levelthread in parallel with the main full-weight thread, the at least oneapplication-level pseudo thread to the separate operating system-levelthread, the computer readable program code when executed on the computercauses the computer to: place work of the application-level pseudothread within a work dispatching queue; and invoke the separateoperating system-level thread to process the work dispatching queue.